home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 4 / FM Towns Free Software Collection 4 - Disc 1.iso / t_os / lprint / getfont.s < prev    next >
Text File  |  1991-10-18  |  2KB  |  106 lines

  1. /*   getfont.s  : font library for gcc on FM-TOWNS
  2.  *
  3.  *         (C) Copyright    Makoto Sakai
  4.  *                      Nifty:    ムンパッパ (MHB02550)     
  5.  *                     junet:    sakai@sra.co.jp
  6.  *
  7.  * Permission to use, copy, modify, and distribute this software and its
  8.  * documentation for any purpose and without fee is hereby granted,
  9.  * provided that the above copyright notice appear in all copies and that
  10.  * both that copyright notice and this permission notice appear in
  11.  * supporting documentation.
  12.  */
  13.     .data
  14.     .text
  15.     .globl _s2jis
  16.     .globl _getfnt
  17.  
  18. /*
  19.     (char *) s2jis(int sjiscode) 
  20. */
  21.     .align 4
  22. _s2jis:
  23.     movl  %ebx,%eax
  24.     movw  4(%esp),%bx
  25.     push  %fs
  26.     pushl %eax
  27.     movb  $2,%ah
  28.  
  29.     pushl $0x0110
  30.     pop   %fs
  31.  
  32.     lcall %fs:(0xa0)
  33.     and   %ah,%ah
  34.     jz    normal
  35.  
  36.     movl  $0xffffffff,%eax
  37.     popl  %ebx
  38.     popl  %fs
  39.     ret
  40.  
  41. normal:
  42.     movl  %ebx,%eax
  43.     popl  %ebx
  44.     popl  %fs
  45.     ret
  46.  
  47. /*
  48.     (char *) getkfnt(int flag, int jiscode, int index) 
  49.         flag 0:hankaku, 1:kanji
  50. */
  51.     .align 4
  52. _getfnt:
  53.     movl  %ebp,%eax
  54.     movl  %esp,%ebp
  55.     pushl %eax
  56.     push  %fs
  57.     pushl %ebx
  58.     pushl %ecx
  59.     pushl %edx
  60.  
  61.     movw  4(%ebp),%ax
  62.     movw  8(%ebp),%bx
  63.     movl  12(%ebp),%ecx
  64.  
  65.     andw  %ax,%ax
  66.     jz    hankaku
  67.  
  68.     movw  $0x0100,%ax    /* kinou code :1  number :0(addr) */
  69.     movw  $0x1010,%dx       /* 16x16 dot */ 
  70.     jmp   gf1
  71.  
  72. hankaku:
  73.     movw  $0x0000,%ax    /* kinou code :0  number :0(addr) */
  74.     movw  $0x0810,%dx       /* 8x16 dot */ 
  75.  
  76. gf1:
  77.     pushl %ds 
  78.     pushl %esi
  79.     pushl %ecx
  80.  
  81.     pushl $0x0110
  82.     pop   %fs
  83.     lcall %fs:(0xa0)
  84.     popl  %ecx
  85.     and   %ah,%ah
  86.     jz    gf2
  87.  
  88.     movl  $0xffffffff,%eax
  89.     jp    exit
  90.     
  91. gf2:
  92.     xorl  %eax,%eax
  93.     addl  %ecx,%esi
  94.     movb  %ds:(%esi),%al
  95. exit:
  96.     popl  %esi
  97.     popl  %ds
  98.  
  99.     popl  %edx
  100.     popl  %ecx
  101.     popl  %ebx
  102.     pop   %fs
  103.     popl  %ebp
  104.  
  105.     ret
  106.